package net.cohoivang.news;

public enum NewsCategory {
	type01(1, "news is type 01"),
	type02(2, "news is type 02"),
	type03(3, "news is type 03");
	
	public final String caption;
	public final int id;
	NewsCategory(int id, String caption) {
		this.id = id;
		this.caption = caption;
	} 
	
	public static NewsCategory getNewsCategory(int id) {
		if (type01.id == id) {
			return type01;
		} else if (type02.id == id) {
			return type02;
		} else if (type03.id == id) {
			return type03;
		} else {
			return null;
		}
	}
}
